package com.qiangesoft.blog.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qiangesoft.blog.core.entity.BlogTag;
import com.qiangesoft.blog.core.pojo.vo.BlogTagVO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 标签 Mapper 接口
 * </p>
 *
 * @author qiange
 * @since 2023-06-05
 */
public interface BlogTagMapper extends BaseMapper<BlogTag> {

    void saveArticleTags(@Param("articleId") Long articleId, @Param("tags") List<Long> tags);

    void deleteByArticleIds(@Param("ids") List<Long> ids);

    List<String> selectByArticleId(Long articleId);

    List<BlogTagVO> findByArticleIdToTags(Long id);

    Page<BlogTag> selectPageRecord(@Param("page") Page<BlogTag> objectPage, @Param("name") String name);

    @MapKey("id")
    List<Map<String, Object>> countTags();

    List<BlogTagVO> selectAll();
}
